package com.itheima.controller;

import com.itheima.Annotation.Log;
import com.itheima.mapper.DeptMapper;
import com.itheima.pojo.Dept;
import com.itheima.pojo.Result;
import com.itheima.service.DeptService;
import com.itheima.service.EmpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 部门管理Controller
 */
@RestController
@RequestMapping("/depts")
public class  DeptController {

    @Autowired
    private DeptService deptService;

    @GetMapping
    public Result getDepts() {
        return Result.success(deptService.getDepts());
    }
    @Log
    @DeleteMapping
    public Result DeleteDepts(Integer id) {
        deptService.DeleteDepts(id);
        return Result.success();
    }
    @Log
    @PostMapping
    public Result AddDept(@RequestBody Dept dept) {
        deptService.AddDept(dept);
        return Result.success();
    }



}
